package Forms;

import java.awt.BorderLayout;
import java.awt.Component;

import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;

import EventoPadrao.EventosProfessor;

@SuppressWarnings("serial")
public class ProfessorJPanel extends EventosProfessor {

	public ProfessorJPanel() {
		setLayout(new BorderLayout(2,2));
		add("Center", organizandoLadoEsquerdo());
		add("East", organizandoLadoDireito());
		add("South", painelNull(0, 20));
	}

	private JPanel organizandoLadoEsquerdo() {
		painelEsquerdo.add("Center", organizandoColunasTables(modelo));
		painelEsquerdo.add("South", organizandoPainelCaixa());
		
		return painelEsquerdo;
	}

	private JPanel organizandoPainelCaixa() {
		JPanel painelContentCaixa = new JPanel(new BorderLayout(2,2));
		painelCaixa.setBorder(BorderFactory.createTitledBorder(
				BorderFactory.createSoftBevelBorder(2), BORDER_CAIXA));

		painelCaixa.add("West", painelContentFormulario());
		painelCaixa.add("Center", painelFormularioJT());
		painelCaixa.add("North", painelNull(0, 10));
		painelCaixa.add("South", painelNull(0, 10));
		
		painelContentCaixa.add("Center", painelCaixa);
		painelContentCaixa.add("North", painelLocaliza(new JLabel("Localizar: ")));
		painelContentCaixa.add("West", painelNull(10, 0));
		
		return painelContentCaixa;
	}

	private Component painelContentFormulario() {
		JPanel painelContent = new JPanel(new BorderLayout());
		
		painelContentControle.add(lbCodigo);
		painelContentControle.add(lbNome);
		painelContentControle.add(lbCPF);
		painelContentControle.add(lbDataNasc);
		painelContentControle.add(lbStatus);
		painelContentControle.add(lbTitulo);
		
		painelContent.add("West", painelNull(100, 0));
		painelContent.add("Center", painelContentControle);
		
		return painelContent;
	}

	private Component painelFormularioJT() {
		
		painelFormulario.add(painelContentComponent("West", tfCodigo));
		painelFormulario.add(painelContentComponent("West", tfNome));
		painelFormulario.add(painelContentComponent("West", ftfCpf));
		painelFormulario.add(painelContentComponent("West", ftfData));
		painelFormulario.add(painelContentComponent("West", comboStatus));
		painelFormulario.add(painelContentComponent("West", comboTitulo));
		
		return painelFormulario;
	}

	private JPanel organizandoLadoDireito() {
		
		painelContent.add(painelButton());
		direitoBranco.add(painelContent);
		painelDireito.add("North", direitoBranco);
		
		return painelDireito;
	}

	private JPanel painelButton() {
		painelBotoes.add(bntCadastrar);
		painelBotoes.add(bntLimpar);
		painelBotoes.add(bntAlterar);
		painelBotoes.add(bntRemover);
		
		return painelBotoes;
	}
}
